﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using ETL.Business.Handlers.ProjectCategoryHandler;
using ETL.Business.Handlers.ProjectHandlers;
using ETL.Business.Handlers.ProjectTaskHandler;
using ETL.Common;

namespace ETL.Business.Helpers
{
    public class GenerateProjectActivity
    {
        public GenerateProjectActivity()
        {
            
        }
        // r["pr_name"].ToString() + "  /  " + r["c_description"].ToString() + "  /  " + r["t_description"].ToString();
        public virtual string Execute(string projectId, string categoryId, string taskId)
        {
            string result = "";
            if(!string.IsNullOrEmpty(projectId) && Utils.IsNumeric(projectId))
            {
                var project = (new GetProjectById()).Execute(int.Parse(projectId));
                if(project != null)
                {
                    result += project.ProjectName;
                }

                //if (!string.IsNullOrEmpty(categoryId) && Utils.IsNumeric(categoryId))
                //{
                //    var category = (new GetCategoryById()).Execute(int.Parse(projectId), int.Parse(categoryId));
                //    if (category != null)
                //    {
                //        result += " / " + category.Description;
                //    }

                    if (!string.IsNullOrEmpty(taskId) && Utils.IsNumeric(taskId))
                    {
                        var task = (new GetProjectTaskById()).Execute(int.Parse(projectId), int.Parse(categoryId), int.Parse(taskId));
                        if (task != null)
                        {
                            result += " / " + task.ProjectName;
                        }
                    }
                //}

            }
            return result;


        }

        public virtual string Execute(string projectId, string categoryId, DateTime startTime)
        {         
            
            return projectId+" / "+categoryId+" / "+"Review at: "+ startTime;


        }
    }
}
